home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / circuits / spice2g6.z / spice2g6 / spice / Fortran / clrmem.f < prev    next >
Encoding:
Text File  |  1989-02-03  |  1.0 KB  |  36 lines

  1.       subroutine clrmem(ipntr)
  2.       implicit double precision (a-h,o-z)
  3.       dimension ipntr(1)
  4. c spice version 2g.6  sccsid=memmgr 3/15/83
  5.       common /memmgr/ cpyknt,istack(1),lorg,icore,maxcor,maxuse,memavl,
  6.      1   ldval,numblk,loctab,ltab,ifwa,nwoff,ntab,maxmem,memerr,nwd4,
  7.      2   nwd8,nwd16
  8.       logical memptr
  9. c
  10. c***  clrmem - release block
  11. c
  12. c
  13. c...  check that pointer is valid
  14.       if (memptr(ipntr(1))) go to 10
  15.       memerr=5
  16.       call errmem(1,memerr,ipntr(1))
  17.    10 msiz=istack(ltab+2)
  18.       muse=istack(ltab+3)
  19.       memavl=memavl+nxtevn(muse)+istack(ltab+6)
  20. c...  assumption:  first allocated block is never cleared.
  21.       ltab1=ltab-ntab
  22.       istack(ltab1+2)=istack(ltab1+2)+msiz
  23. c...  reposition the block table
  24.       nwords=ltab-loctab
  25.       cpyknt=cpyknt+dble(nwords)
  26.       call copy4(istack(loctab+1),istack(loctab+ntab+1),nwords)
  27.       numblk=numblk-1
  28.       loctab=loctab+ntab
  29.       memavl=memavl+ntab
  30.       ltab1=ldval-ntab
  31.       istack(ltab1+2)=istack(ltab1+2)+ntab
  32.       ipntr(1)=2**30-1
  33.       call memadj
  34.       return
  35.       end
  36.